package com.flmes.base.config;


import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Author: flmes
 * @Date: 2024/10/12 21:05
 */
@Component
public class LongToDateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String source) {
        try {
            return new Date(Long.parseLong(source));
        } catch (Exception e) {
            throw new IllegalArgumentException("Invalid date format", e);
        }
    }

}
